﻿<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="xml"/>
  <!-- <xsl:preserve-space elements="code"/> -->
  <xsl:strip-space elements="Chapter"/>
  <xsl:template match="/Book">

    <xsl:text disable-output-escaping="yes">
       
            <![CDATA[
<?xml version="1.0" encoding="UTF-8" ?>]]>
        </xsl:text>
    <package version="2.0" unique-identifier="bookid"
        xmlns="http://www.idpf.org/2007/opf">
      <metadata
          xmlns:dc="http://purl.org/dc/elements/1.1/"
          xmlns:opf="http://www.idpf.org/2007/opf">
        <dc:title>
          <xsl:value-of select="Title"/>
        </dc:title>
        <dc:language>zh-CN</dc:language>
        <dc:publisher>Epub Factory</dc:publisher>
        <dc:coverage></dc:coverage>
        <dc:source>http://www.yitree.info</dc:source>
        <dc:date></dc:date>
        <dc:subject>
          <xsl:value-of select="Subject"/>
        </dc:subject>
        <dc:contributor></dc:contributor>
        <dc:identifier id="bookid">
          <xsl:value-of select="EPubId"/>
        </dc:identifier>
        <dc:type>[type]</dc:type>
        <xsl:for-each select="Authors/string">
          <dc:creator opf:role="aut">
            <xsl:apply-templates/>
          </dc:creator>
        </xsl:for-each>
        <dc:format></dc:format>
        <dc:relation></dc:relation>
        <meta name="cover" content="cover-image"/>
      </metadata>
      <manifest>
        <item href="coverpage.html" id="titlepage" media-type="application/xhtml+xml" />
        <item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml"/>
        <item id="css" href="css/main.css" media-type="text/css"/>
        <item id="cover-image" href="images/cover.jpg" media-type="image/jpeg"/>
      </manifest>
      <spine toc="ncx">
        <itemref idref="titlepage" />

        <xsl:for-each select="Chapters/Chapter">
          <xsl:text disable-output-escaping="yes"><![CDATA[
                    <itemref idref="chapter-]]>
                    </xsl:text>

          <xsl:value-of select="SortOrder"/>
          <xsl:text disable-output-escaping="yes">
                    " />
                    </xsl:text>
        </xsl:for-each>


      </spine>
      <guide>
        <reference type="cover" title="封面" href="coverpage.html"/>
      </guide>
    </package>
  </xsl:template>
</xsl:stylesheet>